package datatypes;


import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import junit.framework.JUnit4TestAdapter;

import org.junit.Before;
import org.junit.Test;

public class LineSegment2D_test {

	Edge edge;
	
	public static junit.framework.Test suite() {
		return new JUnit4TestAdapter(LineSegment2D_test.class);
	}

	@Before
	public void setUp() throws Exception {
		edge = new Edge(new Vertex(1.0, 1.0), new Vertex(10.0, 2.0));
	}

	@Test
	public void testIntersects() {
		Edge other = new Edge(new Vertex(3.0, 1.0), new Vertex(9.0, 2.0));
		assertTrue("Edges should intersect", edge.intersects(other, 0.000001));
	}
	
	@Test
	public void testIntersects_noIntersection() {
		Edge other = new Edge(new Vertex(9.0, 0.0), new Vertex(9.0, 1.0));
		assertFalse("Edges should not intersect", edge.intersects(other, 0.000001));
	}

}
